<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .container{
      width: 950px;
      margin: 0 auto;
    }
    .container ul>li{
      list-style: none;
      border-bottom: 1px solid #ccc;
      width: 300px;
    }
    .container ul>li span{
      cursor: pointer;
      float: right;
    }
  </style>
</head>

<body>
  <div id="app">
    <h1>统共有{{allCount}}个</h1>
    <h1 style="text-align: center">共计{{undoCount}}个待办事项，其中{{doneCount}}个已完成</h1>
    <div>
      <add></add>
      <h1>--------------------------------------------------------------------------</h1>
      <done></done>
      <h1>--------------------------------------------------------------------------</h1>
      <delete-list></delete-list>
    </div>
    <div style="text-align: center;">
      <button @click="cliarAll" style="width: auto;height: 30px;text-align: center;background-color: seagreen;color: #fff;">清空所有！</button>
    </div>
  </div>
  <script src="https://unpkg.com/vue"></script>
  <script src="https://unpkg.com/vuex"></script>
  <script type="module">
    import { store } from './src/stroe.js';
    import {add,deleteList,done} from './src/components/TodoList.js';
    const app = new Vue({
      el: "#app",
      store,
      components: {
        add,
        done,
        'delete-list':deleteList
      },
      data() {
        return {
          msg: 'q23'
        }
      },
      computed: {
        doneCount(){
          return this.$store.getters.doneTodoListCount;
        },
        undoCount(){
          return this.$store.getters.undoListCount;
        },
        allCount(){
          return this.$store.getters.allListCount;
        }
      },
      methods: {
        cliarAll(){
          this.$store.dispatch('clearAll').then(() => {
            alert('清空完成！')
          })
        }
      }
    })
  </script>
</body>

</html>